package com.goodflower.goodflower.creat_mac;

import android.content.Intent;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.goodflower.goodflower.MainActivity;
import com.goodflower.goodflower.R;

public class Creat_mac_one extends AppCompatActivity {
    private EditText creat_mac_name;//花园名字
    private Button btn_creat_mac_one_next;//下一步按钮

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.creat_mac_one);

        //获取控件id
        creat_mac_name = (EditText) findViewById(R.id.creat_mac_name);
        btn_creat_mac_one_next = (Button) findViewById(R.id.btn_creat_mac_one_next);

        //下一步按钮点击事件

        btn_creat_mac_one_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = creat_mac_name.getText().toString();
                if(!(name==null||name.isEmpty())){
                    Intent intent = new Intent(Creat_mac_one.this, Creat_mac_two.class);
                    intent.putExtra("mac_name",name);
                    startActivity(intent);
                }else {
                    Toast.makeText(Creat_mac_one.this,"您必须給花园取一个名字哦~",Toast.LENGTH_LONG).show();
                }
            }
        });
    }
}
